<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            --weui-FG-3: rgba(0, 0, 0, 0.1);
            --weui-BRAND: #07c160;
            --weui-BG-3: #f7f7f7;
        }
        
        * {
            margin: 0;
            padding: 0;
            /* 盒子大小默认计算方式：宽度=内容宽度 */
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
        }
        
        .weui-switch {
            -webkit-tap-highlight-color: transparent;
            /* -webkit chrom 浏览器内核 */
            -webkit-appearance: none;
            /* css世界组织 这个属性还没有被这个组织接纳 可能浏览器不支持 需要加前缀
            -ms-appearance: none; */
            /* 浏览器对form表单元素重置的样式 */
            appearance: none;
            position: relative;
            width: 52px;
            height: 32px;
            border: 2px solid var(--weui-FG-3);
            outline: 0;
            border-radius: 16px;
            padding: 5px;
            -webkit-transition: background-color 0.1s, border 0.1s;
            transition: background-color 0.1s, border 0.1s;
        }
        
        .weui-switch:checked {
            background-color: #07c160;
            background-color: var(--weui-BRAND);
        }
        
        .weui-switch:before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            border-radius: 15px;
            background-color: var(--weui-BG-3);
            transition: transform 0.35s ease, -webkit-transform 0.35s ease;
        }
        
        .weui-switch:after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 28px;
            height: 28px;
            border-radius: 15px;
            background-color: #fff;
            box-shadow: 0 1px 3px rgb(0 0 0 / 40%);
            transition: transform 0.35s ease, -webkit-transform 0.35s ease;
        }
        
        .weui-switch:checked:after {
            transform: translateX(20px);
        }
        
        .weui-switch:checked:before {
            transform: scale(0);
        }
    </style>
</head>

<body>
    <input type="checkbox" checked class="weui-switch">
</body>

</html>